#pragma once

#include <Windows.h>

// ThreadWrapperInfo h-file

struct ThreadWrapperInfo
{
	struct Arguments
	{
		LPSECURITY_ATTRIBUTES lpThreadAttributes;
		SIZE_T dwStackSize;
		LPTHREAD_START_ROUTINE lpStartAddress;
		LPVOID lpParameter;
		DWORD dwCreationFlags;
	} args;
	HANDLE handle;
	HANDLE privateHandle;
	HANDLE exitEvent;
	DWORD threadId;
	bool idling;
	bool comatose;
	volatile DWORD exitcode;
	CONTEXT beforecallcontext;
	//jmp_buf beforecallbuf;
	bool beforecallvalid;
	// TODO: TEST: Attempt to make threads sleep deterministically
	HANDLE hEventSleeping;
	DWORD dwWakeMeAt;
	ThreadWrapperInfo()
	{
		idling = false;
		comatose = false;
		exitcode = 0;
		handle = 0;
		privateHandle = 0;
		exitEvent = 0;
		threadId = 0;
		beforecallvalid = false;
		// TODO: TEST: Attempt to make threads sleep deterministically
		hEventSleeping = CreateEvent(NULL, TRUE, FALSE, NULL);
		dwWakeMeAt = 0;
	}
};
